﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient.UI
{
    // Token: 0x0200191F RID: 6431
    internal class DungeonSelect : DlgBase<DungeonSelect, DungeonSelectBehaviour>
    {
        // Token: 0x17003AF3 RID: 15091
        // (get) Token: 0x06010D40 RID: 68928 RVA: 0x0043CE40 File Offset: 0x0043B040
        // (set) Token: 0x06010D41 RID: 68929 RVA: 0x0043CE58 File Offset: 0x0043B058
        private bool _bLevelIsMoving
        {
            get
            {
                return this.m_bLevelIsMoving;
            }
            set
            {
                if (base.uiBehaviour.m_hardBox != null)
                {
                    base.uiBehaviour.m_hardBox.enabled = !value;
                }
                if (base.uiBehaviour.m_normalBox != null)
                {
                    base.uiBehaviour.m_normalBox.enabled = !value;
                }
                this.m_bLevelIsMoving = value;
            }
        }

        // Token: 0x17003AF4 RID: 15092
        // (get) Token: 0x06010D42 RID: 68930 RVA: 0x0043CEC4 File Offset: 0x0043B0C4
        public string EffectPath
        {
            get
            {
                if (string.IsNullOrEmpty(this.m_effectPath))
                {
                    this.m_effectPath = XSingleton<XGlobalConfig>.singleton.GetValue("DungeonSelectRoleEffectPath");
                }
                return this.m_effectPath;
            }
        }

        // Token: 0x17003AF5 RID: 15093
        // (get) Token: 0x06010D43 RID: 68931 RVA: 0x0043CF00 File Offset: 0x0043B100
        public string EffectPath1
        {
            get
            {
                if (string.IsNullOrEmpty(this.m_effectPath1))
                {
                    this.m_effectPath1 = XSingleton<XGlobalConfig>.singleton.GetValue("DungeonSelectRoleEffectPath1");
                }
                return this.m_effectPath1;
            }
        }

        // Token: 0x17003AF6 RID: 15094
        // (get) Token: 0x06010D44 RID: 68932 RVA: 0x0043CF3C File Offset: 0x0043B13C
        public override string fileName
        {
            get
            {
                return "Hall/DungeonSelect";
            }
        }

        // Token: 0x17003AF7 RID: 15095
        // (get) Token: 0x06010D45 RID: 68933 RVA: 0x0043CF54 File Offset: 0x0043B154
        public override int layer
        {
            get
            {
                return 1;
            }
        }

        // Token: 0x17003AF8 RID: 15096
        // (get) Token: 0x06010D46 RID: 68934 RVA: 0x0043CF68 File Offset: 0x0043B168
        public override bool pushstack
        {
            get
            {
                return true;
            }
        }

        // Token: 0x17003AF9 RID: 15097
        // (get) Token: 0x06010D47 RID: 68935 RVA: 0x0043CF7C File Offset: 0x0043B17C
        public override bool autoload
        {
            get
            {
                return true;
            }
        }

        // Token: 0x17003AFA RID: 15098
        // (get) Token: 0x06010D48 RID: 68936 RVA: 0x0043CF90 File Offset: 0x0043B190
        public override bool fullscreenui
        {
            get
            {
                return true;
            }
        }

        // Token: 0x17003AFB RID: 15099
        // (get) Token: 0x06010D49 RID: 68937 RVA: 0x0043CFA4 File Offset: 0x0043B1A4
        public override bool hideMainMenu
        {
            get
            {
                return true;
            }
        }

        // Token: 0x06010D4A RID: 68938 RVA: 0x0043CFB8 File Offset: 0x0043B1B8
        protected override void Init()
        {
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            //zcg this._welfareDoc = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
            if (this._SelectedChapter == 0)
            {
                this._SelectedChapter = XSingleton<XStageProgress>.singleton.GetPlayerLastChapter(this._SelectDifficult);
            }
            OpenSystemTable.RowData sysData = XSingleton<XGameSysMgr>.singleton.GetSysData(XSysDefineMgr.GetTypeInt(XSysDefine.XSys_Level_Elite));
            if (sysData != null)
            {
                this._HardModeNeedLevel = sysData.PlayerLevel;
            }
            else
            {
                this._HardModeNeedLevel = 1;
                XSingleton<XDebug>.singleton.AddErrorLog("_sysData is nill", null, null, null, null, null);
            }
        }

        // Token: 0x06010D4B RID: 68939 RVA: 0x0043D05C File Offset: 0x0043B25C
        public GameObject GetGoLevelUpInfo()
        {
            return this.m_goLevelUpGo;
        }

        // Token: 0x06010D4C RID: 68940 RVA: 0x0043D074 File Offset: 0x0043B274
        public void FadeShow()
        {
            if (!base.IsVisible())
            {
                XAutoFade.FadeOut2In(0.5f, 0.5f);
                XSingleton<XTimerMgr>.singleton.SetTimer(0.484f, new XTimerMgr.ElapsedEventHandler(this.InnerShow), null);
            }
        }

        // Token: 0x06010D4D RID: 68941 RVA: 0x0043D0C0 File Offset: 0x0043B2C0
        private void InnerShow(object o)
        {
            this.SetVisible(true, true);
            XTaskDocument specificDocument = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
            specificDocument.ResetNavi();
        }

        // Token: 0x06010D4E RID: 68942 RVA: 0x0043D0EC File Offset: 0x0043B2EC
        protected override void OnShow()
        {
            base.OnShow();
            base.uiBehaviour.m_SceneDetail.SetActive(false);
            base.Alloc3DAvatarPool("DungeonSelect");
            XMainInterfaceDocument specificDocument = XDocuments.GetSpecificDocument<XMainInterfaceDocument>(XMainInterfaceDocument.uuID);
            specificDocument.OnTopUIRefreshed(this);
            XTaskDocument specificDocument2 = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
            if (this.IsTaskMode)
            {
                int naviScene = (int)specificDocument2.NaviScene;
                if (naviScene != 0)
                {
                    this.SetAutoSelectScene(naviScene, 0, 0U);
                    this._bAutoSelect = false;
                    this._bAutoSelectChapterId = true;
                }
                this.IsTaskMode = false;
            }
            //zcg 
//             if (DlgBase<XPurchaseView, XPurchaseBehaviour>.singleton.IsVisible())
//             {
//                 DlgBase<XPurchaseView, XPurchaseBehaviour>.singleton.OnCloseClicked(null);
//             }
//             if (DlgBase<XCharacterCommonMenuView, XCharacterCommonMenuBehaviour>.singleton.IsVisible())
//             {
//                 DlgBase<XCharacterCommonMenuView, XCharacterCommonMenuBehaviour>.singleton.SetVisible(false, true);
//             }
            if (DlgBase<XOptionsView, XOptionsBehaviour>.singleton.IsVisible())
            {
                DlgBase<XOptionsView, XOptionsBehaviour>.singleton.SetVisible(false, true);
            }
            //zcg 
//             if (DlgBase<XFlowerSendView, XFlowerSendBehaviour>.singleton.IsVisible())
//             {
//                 DlgBase<XFlowerSendView, XFlowerSendBehaviour>.singleton.SetVisible(false, true);
//             }
//             if (DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.IsLoaded() && DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.IsVisible())
//             {
//                 DlgBase<ScreenShotShareView, ScreenShotShareBehaviour>.singleton.SetVisible(false, true);
//             }
            bool flag7 = this._SelectDifficult == 0U;
            base.uiBehaviour.m_cbNormal.ForceSetFlag(false);
            base.uiBehaviour.m_cbHard.ForceSetFlag(false);
            if (this._bAutoSelect)
            {
                this.OnSwitchDifficult(flag7 ? base.uiBehaviour.m_Normal : base.uiBehaviour.m_Hard);
            }
            else
            {
                base.uiBehaviour.m_cbNormal.bChecked = flag7;
                base.uiBehaviour.m_cbHard.bChecked = !flag7;
                this.SetupChapterImage();
            }
            //zcg  XTeamDocument specificDocument3 = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
            //zcg specificDocument3.ReqTeamOp(TeamOperate.TEAM_QUERYCOUNT, 0UL, null, TeamMemberType.TMT_NORMAL, null);
            //zcg XDailyActivitiesDocument specificDocument4 = XDocuments.GetSpecificDocument<XDailyActivitiesDocument>(XDailyActivitiesDocument.uuID);
            //zcg specificDocument4.QueryDailyActivityData();
        }

        // Token: 0x06010D4F RID: 68943 RVA: 0x0043D2DC File Offset: 0x0043B4DC
        private void ResetTexture(GameObject frame)
        {
            if (frame != null)
            {
                Transform transform = frame.transform.Find("BG");
                if (transform != null)
                {
                    IXUITexture ixuitexture = transform.GetComponent("XUITexture") as IXUITexture;
                    ixuitexture.SetTexturePath("");
                }
            }
        }

        // Token: 0x06010D50 RID: 68944 RVA: 0x0043D334 File Offset: 0x0043B534
        protected override void OnHide()
        {
            base.OnHide();
            this.main.Clear();
            this.left.Clear();
            this.right.Clear();
            base.Return3DAvatarPool();
            this.bossDummy = null;
            XSingleton<XInput>.singleton.Freezed = false;
            this.ResetTexture(this._MainFrame);
            this.ResetTexture(this._LeftFrame);
            this.ResetTexture(this._RightFrame);
            this._bLevelIsMoving = false;
            base.uiBehaviour.m_LevelTween.StopTween();
            base.uiBehaviour.m_LevelTween.ResetTweenByGroup(true, 1);
            base.uiBehaviour.m_cbHard.ForceSetFlag(false);
            base.uiBehaviour.m_cbNormal.ForceSetFlag(false);
        }

        // Token: 0x06010D51 RID: 68945 RVA: 0x0043D400 File Offset: 0x0043B600
        protected override void OnUnload()
        {
            XSingleton<X3DAvatarMgr>.singleton.OnUIUnloadMainDummy(this.main.snapShot);
            base.Return3DAvatarPool();
            this.bossDummy = null;
            if (this.m_fx != null)
            {
                XSingleton<XFxMgr>.singleton.DestroyFx(this.m_fx, true);
                this.m_fx = null;
            }
            if (this.m_fx1 != null)
            {
                XSingleton<XFxMgr>.singleton.DestroyFx(this.m_fx1, true);
                this.m_fx1 = null;
            }
            base.OnUnload();
        }

        // Token: 0x06010D52 RID: 68946 RVA: 0x0043D48C File Offset: 0x0043B68C
        public override void RegisterEvent()
        {
            base.uiBehaviour.m_Normal.ID = 0UL;
            base.uiBehaviour.m_Hard.ID = 1UL;
            base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
            base.uiBehaviour.m_Normal.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSwitchDifficult));
            base.uiBehaviour.m_Hard.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSwitchDifficult));
            base.uiBehaviour.m_LevelBg.RegisterSpriteDragEventHandler(new SpriteDragEventHandler(this.OnLevelBgDrag));
            base.uiBehaviour.m_SceneClose.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnDetailClose));
            base.uiBehaviour.m_SceneQuick1.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnQuickClicked));
            base.uiBehaviour.m_SceneQuick10.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnQuickClicked));
            base.uiBehaviour.m_SceneGoBattle.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGoBattleBtnClicked));
            base.uiBehaviour.m_SceneSoloBattle.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSoloBattleClicked));
            base.uiBehaviour.m_SceneTeamBattle.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnTeamBattleClicked));
            base.uiBehaviour.m_ShopBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnShopBtnClick));
            base.uiBehaviour.m_Left.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnMoveLeft));
            base.uiBehaviour.m_Right.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnMoveRight));
            base.uiBehaviour.m_BoxFrameBg.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnChapterBoxBgClick));
            base.uiBehaviour.m_BtnAddHardLeftCount0.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnAddHardCountClicked));
            base.uiBehaviour.m_BtnAddHardLeftCount1.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnAddHardCountClicked));
            base.uiBehaviour.m_PrerogativeBg.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnMemberPrivilegeClicked));
            base.uiBehaviour.m_addTicketSpr.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickAddTicketBtn));
        }

        // Token: 0x06010D53 RID: 68947 RVA: 0x0023F430 File Offset: 0x0023D630
        private void OnMemberPrivilegeClicked(IXUISprite btn)
        {
            //zcg DlgBase<XWelfareView, XWelfareBehaviour>.singleton.CheckActiveMemberPrivilege(MemberPrivilege.KingdomPrivilege_Adventurer);
        }

        // Token: 0x06010D54 RID: 68948 RVA: 0x0043D6CA File Offset: 0x0043B8CA
        private void OnClickAddTicketBtn(IXUISprite spr)
        {
            XSingleton<UiUtility>.singleton.ShowItemAccess(XSingleton<XGlobalConfig>.singleton.GetInt("SweepTicketId"), null);
        }

        // Token: 0x06010D55 RID: 68949 RVA: 0x0043D6E8 File Offset: 0x0043B8E8
        protected void OnSwitchDifficult(IXUISprite sp)
        {
            if (!this._bLevelIsMoving)
            {
                uint num = (uint)sp.ID;
                if (1U == num)
                {
                    if (!this._IsHardModeEnable())
                    {
                        base.uiBehaviour.m_cbHard.bChecked = false;
                        base.uiBehaviour.m_cbNormal.bChecked = true;
                        XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("DUNGEONSELECT_HARDMODE_LEVEL_LIMIT_FMT", new object[]
                        {
                            this._HardModeNeedLevel
                        }), "fece00");
                        return;
                    }
                }
                else
                {
                    if (!XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Level_Normal))
                    {
                        return;
                    }
                }
                base.uiBehaviour.m_cbHard.bChecked = (1U == num);
                base.uiBehaviour.m_cbNormal.bChecked = (1U != num);
                if (this._bAutoSelectChapterId)
                {
                    int playerLocationChapter = XSingleton<XStageProgress>.singleton.GetPlayerLocationChapter(num);
                    this._SelectedChapter = playerLocationChapter;
                }
                else
                {
                    this._bAutoSelectChapterId = true;
                }
                this._SelectDifficult = num;
                this.SetupChapterImage();
                XSingleton<XDebug>.singleton.AddGreenLog("OnSwitchDifficult", null, null, null, null, null);
            }
        }

        // Token: 0x06010D56 RID: 68950 RVA: 0x0043D818 File Offset: 0x0043BA18
        private bool _IsHardModeEnable()
        {
            bool result;
            if (XSingleton<XAttributeMgr>.singleton.XPlayerData != null)
            {
                result = ((long)this._HardModeNeedLevel <= (long)((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level));
            }
            else
            {
                XSingleton<XDebug>.singleton.AddGreenLog("XAttributeMgr.singleton.XPlayerData is null", null, null, null, null, null);
                result = false;
            }
            return result;
        }

        // Token: 0x06010D57 RID: 68951 RVA: 0x0043D874 File Offset: 0x0043BA74
        public void AutoShowLastChapter(uint difficult, bool showDetailFrame = true)
        {
            if (1U == difficult && !this._IsHardModeEnable())
            {
                difficult = 0U;
            }
            this._SelectDifficult = difficult;
            this._SelectedChapter = XSingleton<XStageProgress>.singleton.GetPlayerLocationChapter(this._SelectDifficult);
            this._SelectScene = XSingleton<XStageProgress>.singleton.GetPlayerLastSceneInChapter(this._SelectedChapter);
            if (this._SelectDifficult == 0U)
            {
                this.OnSwitchDifficult(base.uiBehaviour.m_Normal);
            }
            else
            {
                this.OnSwitchDifficult(base.uiBehaviour.m_Hard);
            }
            if (this._SelectScene > 0U && showDetailFrame)
            {
                this._SetupDetailFrame(this._SelectScene);
            }
        }

        // Token: 0x06010D58 RID: 68952 RVA: 0x0043D920 File Offset: 0x0043BB20
        protected bool OnQuickClicked(IXUIButton button)
        {
            bool result;
            if (this.SetButtonCool(this.m_fSweepBtnCoolTime))
            {
                result = true;
            }
            else
            {
                if (!XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Level_Swap))
                {
                    XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("SWAP_NOT_OPEN"), "fece00");
                    result = true;
                }
                else
                {
                    if (this._SelectDifficult == 1U)
                    {
                        XMainInterfaceDocument xmainInterfaceDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XMainInterfaceDocument.uuID) as XMainInterfaceDocument;
                        SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(this._SelectScene);
                        if (sceneData != null && xmainInterfaceDocument != null && xmainInterfaceDocument.GetPlayerPPT() < sceneData.SweepNeedPPT)
                        {
                            XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("SWEEPPPT_NOTENOUGH"), "fece00");
                            return true;
                        }
                        if (XSingleton<XGame>.singleton.Doc.XBagDoc.GetItemCount(87) <= 0UL)
                        {
                            XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("SWEEPTICKETS_NOTENOUGH"), "fece00");
                            return true;
                        }
                        //zcg
//                         XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
//                         int expIDBySceneID = specificDocument.GetExpIDBySceneID(this._SelectScene);
//                         if (!specificDocument.CheckCountAndBuy(expIDBySceneID, sceneData))
//                         {
//                             return true;
//                         }
                    }
                    if (this.OnLackPower())
                    {
                        result = true;
                    }
                    else
                    {
                        if (this._SelectScene > 0U)
                        {
                            //zcg
//                             XSweepDocument specificDocument2 = XDocuments.GetSpecificDocument<XSweepDocument>(XSweepDocument.uuID);
//                             if (button.gameObject.name == "Quick1")
//                             {
//                                 specificDocument2.StartSweep(this._SelectScene, 1U);
//                             }
//                             else
//                             {
//                                 if (button.gameObject.name == "Quick10")
//                                 {
//                                     if (this._SelectDifficult == 0U)
//                                     {
//                                         specificDocument2.StartSweep(this._SelectScene, 10U);
//                                     }
//                                     else
//                                     {
//                                         if (this._SelectDifficult == 1U)
//                                         {
//                                             specificDocument2.StartSweep(this._SelectScene, 5U);
//                                         }
//                                     }
//                                 }
//                             }
                        }
                        result = true;
                    }
                }
            }
            return result;
        }

        // Token: 0x06010D59 RID: 68953 RVA: 0x0043DB40 File Offset: 0x0043BD40
        private bool SetButtonCool(float time)
        {
            float num = Time.realtimeSinceStartup - this.m_fLastClickBtnTime;
            bool result;
            if (num < time)
            {
                result = true;
            }
            else
            {
                this.m_fLastClickBtnTime = Time.realtimeSinceStartup;
                result = false;
            }
            return result;
        }

        // Token: 0x06010D5A RID: 68954 RVA: 0x0043DB78 File Offset: 0x0043BD78
        protected bool OnCloseClicked(IXUIButton button)
        {
            bool result;
            if (this._bLevelIsMoving)
            {
                XSingleton<XDebug>.singleton.AddLog("isMoving!!!!", null, null, null, null, null, XDebugColor.XDebug_None);
                result = true;
            }
            else
            {
                this.SetVisible(false, true);
                result = true;
            }
            return result;
        }

        // Token: 0x06010D5B RID: 68955 RVA: 0x0043DBBC File Offset: 0x0043BDBC
        protected bool OnResetClicked(IXUIButton button)
        {
            int num = 0;
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            if (xlevelDocument.SceneBuyCount.ContainsKey(this._SelectScene))
            {
                num = (int)xlevelDocument.SceneBuyCount[this._SelectScene];
            }
            List<uint> list = ListPool<uint>.Get();
            string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("BuyStageCountCost").Split(XGlobalConfig.ListSeparator);
            uint num2 = 0U;
            while ((ulong)num2 < (ulong)((long)array.Length))
            {
                list.Add(uint.Parse(array[(int)num2]));
                num2 += 1U;
            }
            if (num >= list.Count)
            {
                num = list.Count - 1;
            }
            uint num3 = list[num];
            string label = string.Format(XStringDefineProxy.GetString("RESET_LEVEL"), num3);
            XSingleton<UiUtility>.singleton.ShowModalDialog(label, XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this._ResetScene));
            ListPool<uint>.Release(list);
            return true;
        }

        // Token: 0x06010D5C RID: 68956 RVA: 0x0043DCD4 File Offset: 0x0043BED4
        protected bool _ResetScene(IXUIButton button)
        {
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            xlevelDocument.ResetScene((int)this._SelectScene);
            XSingleton<UiUtility>.singleton.CloseModalDlg();
            return true;
        }

        // Token: 0x06010D5D RID: 68957 RVA: 0x0043DD19 File Offset: 0x0043BF19
        public void OnResetSucc()
        {
            this._SetupDetailFrame(this._SelectScene);
        }

        // Token: 0x06010D5E RID: 68958 RVA: 0x0043DD2C File Offset: 0x0043BF2C
        public bool OnGoBattleBtnClicked(IXUIButton go)
        {
            if (this._SelectScene > 0U)
            {
                if (this.OnLackPower())
                {
                    return true;
                }
                SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(this._SelectScene);
                if (sceneData == null)
                {
                    XSingleton<XDebug>.singleton.AddErrorLog("sceneData is null", null, null, null, null, null);
                    return true;
                }
                float num = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("SceneGotoPower"));
                if (XSingleton<PPTCheckMgr>.singleton.CheckMyPPT(Mathf.FloorToInt((float)sceneData.RecommendPower * num)))
                {
                    this.GoBattle(null);
                }
                else
                {
                    base.uiBehaviour.m_SceneDetail.gameObject.SetActive(false);
                    XSingleton<PPTCheckMgr>.singleton.ShowPPTNotEnoughDlg(0UL, new ButtonClickEventHandler(this.GoBattle));
                }
            }
            return true;
        }

        // Token: 0x06010D5F RID: 68959 RVA: 0x0043DE0C File Offset: 0x0043C00C
        public bool OnSoloBattleClicked(IXUIButton go)
        {
            if (this._SelectDifficult == 1U)
            {
                SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(this._SelectScene);
                if (sceneData == null)
                {
                    XSingleton<XDebug>.singleton.AddErrorLog("sceneData is null", null, null, null, null, null);
                    return true;
                }
                float num = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("SceneGotoPower"));
                if (XSingleton<PPTCheckMgr>.singleton.CheckMyPPT(Mathf.FloorToInt((float)sceneData.RecommendPower * num)))
                {
                    this.OnRealSoloBattleClicked(null);
                }
                else
                {
                    base.uiBehaviour.m_SceneDetail.gameObject.SetActive(false);
                    XSingleton<PPTCheckMgr>.singleton.ShowPPTNotEnoughDlg(0UL, new ButtonClickEventHandler(this.OnRealSoloBattleClicked));
                }
            }
            return true;
        }

        // Token: 0x06010D60 RID: 68960 RVA: 0x0043DED8 File Offset: 0x0043C0D8
        public bool OnRealSoloBattleClicked(IXUIButton go)
        {
            bool result;
            if (this.OnLackPower())
            {
                result = true;
            }
            else
            {
                //zcg 
//                 XTeamDocument specificDocument = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
//                 if (specificDocument.bInTeam)
//                 {
//                     XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_TEAM_ALREADY_INTEAM"), "fece00");
//                     result = true;
//                 }
//                 else
                {
                    result = true;
                }
            }
            return result;
        }

        // Token: 0x06010D61 RID: 68961 RVA: 0x0043DF30 File Offset: 0x0043C130
        public bool OnTeamBattleClicked(IXUIButton go)
        {
            if (this._SelectDifficult == 1U)
            {
                SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(this._SelectScene);
                float num = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("SceneGotoPower"));
                if (sceneData != null)
                {
                    if (XSingleton<PPTCheckMgr>.singleton.CheckMyPPT(Mathf.FloorToInt((float)sceneData.RecommendPower * num)))
                    {
                        this.OnRealTeamBattleClicked(null);
                    }
                    else
                    {
                        base.uiBehaviour.m_SceneDetail.gameObject.SetActive(false);
                        XSingleton<PPTCheckMgr>.singleton.ShowPPTNotEnoughDlg(0UL, new ButtonClickEventHandler(this.OnRealTeamBattleClicked));
                    }
                }
            }
            return true;
        }

        // Token: 0x06010D62 RID: 68962 RVA: 0x0043DFE4 File Offset: 0x0043C1E4
        public bool OnRealTeamBattleClicked(IXUIButton go)
        {
            //zcg 
//             XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
//             XTeamDocument specificDocument2 = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
//             int expIDBySceneID = specificDocument.GetExpIDBySceneID(this._SelectScene);
//             specificDocument2.SetAndMatch(expIDBySceneID);
            return true;
        }

        // Token: 0x06010D63 RID: 68963 RVA: 0x0043E024 File Offset: 0x0043C224
        private bool OnLackPower()
        {
            return this.OnLackPower(1);
        }

        // Token: 0x06010D64 RID: 68964 RVA: 0x0043E040 File Offset: 0x0043C240
        private bool OnLackPower(int times)
        {
            bool result;
            if (!XSingleton<UiUtility>.singleton.CanEnterBattleScene(this._SelectScene, times))
            {
                if (XSingleton<UiUtility>.singleton.IsMaxBuyPowerCnt())
                {
                    XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_SCENE_NOFATIGUE"), "fece00");
                }
                else
                {
                    //zcg  DlgBase<XPurchaseView, XPurchaseBehaviour>.singleton.ShowBorad(ItemEnum.FATIGUE);
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return result;
        }

        // Token: 0x06010D65 RID: 68965 RVA: 0x0043E0AC File Offset: 0x0043C2AC
        protected bool GoBattle(IXUIButton go)
        {
            DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
            bool result;
            //zcg 
//             if (XTeamDocument.GoSingleBattleBeforeNeed(new ButtonClickEventHandler(this.GoBattle), go))
//             {
//                 result = true;
//             }
//             else
            {
                if (this.SetButtonCool(this.m_fGoBattleCoolTime))
                {
                    result = true;
                }
                else
                {
                    PtcC2G_EnterSceneReq ptcC2G_EnterSceneReq = new PtcC2G_EnterSceneReq();
                    ptcC2G_EnterSceneReq.Data.sceneID = this._SelectScene;
                    XSingleton<XClientNetwork>.singleton.Send(ptcC2G_EnterSceneReq);
                    result = true;
                }
            }
            return result;
        }

        // Token: 0x06010D66 RID: 68966 RVA: 0x0043E120 File Offset: 0x0043C320
        public void SetAutoSelectScene(int sceneid, int chapterid, uint diff)
        {
            this._bAutoSelectChapterId = false;
            if (sceneid == 0)
            {
                this._SelectDifficult = diff;
                this._SelectedChapter = chapterid;
                this._SelectScene = 0U;
                if (this._SelectedChapter == 0)
                {
                    this._SelectedChapter = XSingleton<XStageProgress>.singleton.GetPlayerLocationChapter(this._SelectDifficult);
                }
                this._bAutoSelect = true;
            }
            else
            {
                this._SelectScene = (uint)sceneid;
                this._SelectedChapter = XSingleton<XSceneMgr>.singleton.GetSceneChapter(sceneid);
                this._SelectDifficult = (uint)XSingleton<XSceneMgr>.singleton.GetSceneDifficult(sceneid);
                this._bAutoSelect = true;
            }
        }

        // Token: 0x06010D67 RID: 68967 RVA: 0x0043E1AF File Offset: 0x0043C3AF
        public void SelectChapter(int chapterid, uint diff)
        {
            this._SelectScene = 0U;
            this._SelectedChapter = chapterid;
            this._SelectDifficult = diff;
            this.FadeShow();
        }

        // Token: 0x06010D68 RID: 68968 RVA: 0x0043E1D0 File Offset: 0x0043C3D0
        protected GameObject GetLevelFrame()
        {
            return base.uiBehaviour.m_SceneFramePool.FetchGameObject(false);
        }

        // Token: 0x06010D69 RID: 68969 RVA: 0x0043E1F4 File Offset: 0x0043C3F4
        protected void SetupChapterBaseImage(int chapter, uint difficult, GameObject frame)
        {
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            XChapter.RowData chapter2 = XSingleton<XSceneMgr>.singleton.GetChapter(chapter);
            IXUILabel ixuilabel = frame.transform.Find("Title").GetComponent("XUILabel") as IXUILabel;
            if (chapter2 != null)
            {
                ixuilabel.SetText(chapter2.Comment);
            }
            Transform transform = frame.transform.Find("me");
            IXUISprite ixuisprite = frame.transform.Find("me/me/me").GetComponent("XUISprite") as IXUISprite;
            ixuisprite.spriteName = XSingleton<XProfessionSkillMgr>.singleton.GetSuperRiskAvatar(XSingleton<XEntityMgr>.singleton.Player.BasicTypeID);
            ixuisprite.MakePixelPerfect();
            transform.gameObject.SetActive(false);
            Transform transform2 = frame.transform.Find("BG");
            if (transform2 != null)
            {
                IXUITexture ixuitexture = transform2.GetComponent("XUITexture") as IXUITexture;
                if (chapter2 != null)
                {
                    ixuitexture.SetTexturePath("atlas/UI/Hall/LevelBg/" + chapter2.Pic);
                }
            }
            List<uint> list = ListPool<uint>.Get();
            XSingleton<XSceneMgr>.singleton.GetSceneListByChapter(chapter, list);
            if (list.Count == 0)
            {
                ListPool<uint>.Release(list);
            }
            else
            {
                list.Sort();
                if (difficult == 0U)
                {
                    base.uiBehaviour.m_NormalBg.SetActive(true);
                    base.uiBehaviour.m_HardBg.SetActive(false);
                    base.uiBehaviour.m_HardLeftCountGo0.SetActive(false);
                    base.uiBehaviour.m_ShopBtn.SetVisible(false);
                }
                else
                {
                    //zcg base.uiBehaviour.m_PrerogativeSpr.SetGrey(this._welfareDoc.IsOwnMemberPrivilege(MemberPrivilege.KingdomPrivilege_Adventurer));
                    //zcg base.uiBehaviour.m_PrerogativeSpr.SetSprite(this._welfareDoc.GetMemberPrivilegeIcon(MemberPrivilege.KingdomPrivilege_Adventurer));
                    //zcg base.uiBehaviour.m_PrerogativeLab.SetEnabled(this._welfareDoc.IsOwnMemberPrivilege(MemberPrivilege.KingdomPrivilege_Adventurer));
                    //zcg base.uiBehaviour.m_PrerogativeLab.SetText(string.Format(XStringDefineProxy.GetString("Prerogative_Abyss"), this._welfareDoc.GetMemberPrivilegeConfig(MemberPrivilege.KingdomPrivilege_Adventurer).AbyssCount));
                    base.uiBehaviour.m_NormalBg.SetActive(false);
                    base.uiBehaviour.m_HardBg.SetActive(true);
                    base.uiBehaviour.m_HardLeftCountGo0.SetActive(true);
                    base.uiBehaviour.m_ShopBtn.SetVisible(true);
                }
                bool flag6 = false;
                GameObject fx = null;
                Transform parent = frame.transform.Find("Levels");
                XSingleton<X3DAvatarMgr>.singleton.ClearDummy(this.m_dummPool);
                this.bossDummy = null;
                if (frame == this._MainFrame)
                {
                    this._isShowBossAvatar = true;
                }
                for (int i = 0; i < list.Count; i++)
                {
                    uint num = list[i];
                    SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(num);
                    int num2 = XSingleton<XStageProgress>.singleton.GetRank(sceneData.id);
                    if (num2 == -1)
                    {
                        num2 = 0;
                    }
                    if (sceneData != null)
                    {
                        GameObject gameObject = base.uiBehaviour.m_ScenePool.FetchGameObject(false);
                        gameObject.name = sceneData.id.ToString();
                        gameObject.transform.parent = parent;
                        if (sceneData.UIPos != null)
                        {
                            gameObject.transform.localPosition = new Vector3((float)sceneData.UIPos[0], (float)sceneData.UIPos[1], 600f);
                        }
                        else
                        {
                            XSingleton<XDebug>.singleton.AddErrorLog("'uipos' is null,To the plotter(ce hua) Find a solution,please,sceneId = " + num.ToString() + " chapter:" + chapter, null, null, null, null, null);
                        }
                        gameObject.transform.localScale = Vector3.one;
                        this.SceneDic[num] = gameObject;
                        IXUISprite ixuisprite2 = gameObject.transform.Find("SprBtn").GetComponent("XUISprite") as IXUISprite;
                        ixuisprite2.ID = (ulong)sceneData.id;
                        ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSceneSelected));
                        IXUISprite ixuisprite3 = gameObject.transform.Find("LevelPic").GetComponent("XUISprite") as IXUISprite;
                        IXUISprite ixuisprite4 = gameObject.transform.Find("Star1").GetComponent("XUISprite") as IXUISprite;
                        IXUISprite ixuisprite5 = gameObject.transform.Find("Star2").GetComponent("XUISprite") as IXUISprite;
                        IXUISprite ixuisprite6 = gameObject.transform.Find("Star3").GetComponent("XUISprite") as IXUISprite;
                        GameObject gameObject2 = gameObject.transform.Find("TaskHint").gameObject;
                        Transform transform3 = gameObject.transform.Find("Snapshot");
                        IXUISprite ixuisprite7 = gameObject.transform.Find("Box").GetComponent("XUISprite") as IXUISprite;
                        IXUILabel ixuilabel2 = gameObject.transform.Find("Hint").GetComponent("XUILabel") as IXUILabel;
                        IXUILabel ixuilabel3 = gameObject.transform.Find("Hint/GoLevelup").GetComponent("XUILabel") as IXUILabel;
                        IXUISprite ixuisprite8 = gameObject.transform.Find("BoxFx").GetComponent("XUISprite") as IXUISprite;
                        ixuisprite7.gameObject.SetActive(false);
                        ixuilabel2.gameObject.SetActive(false);
                        ixuisprite8.gameObject.SetActive(false);
                        XTaskDocument specificDocument = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
                        gameObject2.SetActive(specificDocument.GetSceneTaskState(num).Count > 0);
                        if (difficult == 0U)
                        {
                            ixuisprite3.SetSprite("gk_0");
                        }
                        else
                        {
                            ixuisprite3.SetSprite("gk_1");
                        }
                        ixuisprite4.gameObject.SetActive(true);
                        ixuisprite4.spriteName = "gk_3";
                        ixuisprite5.gameObject.SetActive(true);
                        ixuisprite5.spriteName = "gk_3";
                        ixuisprite6.gameObject.SetActive(true);
                        ixuisprite6.spriteName = "gk_3";
                        if (num2 >= 1)
                        {
                            ixuisprite4.spriteName = "gk_4";
                        }
                        if (num2 >= 2)
                        {
                            ixuisprite5.spriteName = "gk_4";
                        }
                        if (num2 >= 3)
                        {
                            ixuisprite6.spriteName = "gk_4";
                        }
                        if (num2 == 0)
                        {
                            ixuisprite4.gameObject.SetActive(false);
                            ixuisprite5.gameObject.SetActive(false);
                            ixuisprite6.gameObject.SetActive(false);
                        }
                        ixuisprite3.SetGrey(!flag6);
                        if (num2 <= 0)
                        {
                            SceneRefuseReason sceneRefuseReason = SceneRefuseReason.Invalid;
                            if (!flag6)
                            {
                                sceneRefuseReason = xlevelDocument.CanLevelOpen(num);
                                ixuisprite3.SetGrey(true);
                                transform.localPosition = gameObject.transform.localPosition;
                                fx = transform.gameObject;
                                if (i == list.Count - 1)
                                {
                                    this._isShowBossAvatar = false;
                                }
                                if (sceneRefuseReason != SceneRefuseReason.Admit)
                                {
                                    ixuilabel2.gameObject.SetActive(true);
                                    if (sceneRefuseReason == SceneRefuseReason.PreTask_Notfinish)
                                    {
                                        ixuilabel3.SetText(XStringDefineProxy.GetString("LEVEL_GO_TASK"));
                                        ixuilabel2.SetText(string.Format(XStringDefineProxy.GetString("LEVEl_REQUIRE_TASK"), new object[0]));
                                        ixuilabel3.RegisterLabelClickEventHandler(new LabelClickEventHandler(this.OnGoLevelupClick));
                                    }
                                    else
                                    {
                                        if (sceneRefuseReason == SceneRefuseReason.PreScene_Notfinish)
                                        {
                                            ixuilabel3.SetText(XStringDefineProxy.GetString("LEVEL_GO_SCENE"));
                                            int unFinishedPreSceneID = xlevelDocument.GetUnFinishedPreSceneID(sceneData);
                                            SceneTable.RowData sceneData2 = XSingleton<XSceneMgr>.singleton.GetSceneData((uint)unFinishedPreSceneID);
                                            if (sceneData2 != null)
                                            {
                                                ixuilabel2.SetText(string.Format(XStringDefineProxy.GetString("LEVEL_REQUIRE_PRELEVEL"), sceneData2.Comment));
                                            }
                                            ixuilabel3.RegisterLabelClickEventHandler(new LabelClickEventHandler(this.OnGoLevelupClick));
                                        }
                                        else
                                        {
                                            if (SceneRefuseReason.ReachLimitTimes == sceneRefuseReason)
                                            {
                                                ixuilabel3.SetText(XStringDefineProxy.GetString("LEVEL_REACH_LIMIT_TIMES"));
                                                ixuilabel2.SetText(XStringDefineProxy.GetString("LEVEL_REACH_LIMIT_TIMES"));
                                                ixuilabel3.RegisterLabelClickEventHandler(new LabelClickEventHandler(this.OnGoLevelupClick));
                                            }
                                            else
                                            {
                                                ixuilabel3.SetText(XStringDefineProxy.GetString("LEVEL_GO_UP"));
                                                ixuilabel2.SetText(string.Format(XStringDefineProxy.GetString("LEVEL_REQUIRE_LEVEL"), sceneData.RequiredLevel));
                                                this.m_goLevelUpGo = ixuilabel2.gameObject;
                                                XSingleton<XDebug>.singleton.AddGreenLog("get farme", null, null, null, null, null);
                                            }
                                        }
                                    }
                                    ixuilabel3.ID = (ulong)sceneData.id;
                                }
                            }
                            if (sceneRefuseReason == SceneRefuseReason.Admit)
                            {
                                transform.localPosition = gameObject.transform.localPosition;
                                fx = transform.gameObject;
                            }
                            flag6 = true;
                        }
                        else
                        {
                            transform.localPosition = gameObject.transform.localPosition;
                            fx = transform.gameObject;
                        }
                        if (sceneData.SceneChest != 0 && sceneData.BoxUIPos != null && sceneData.BoxUIPos.Length == 2)
                        {
                            GameObject gameObject3 = base.uiBehaviour.m_ScenePool.FetchGameObject(false);
                            gameObject3.name = "chest" + num;
                            gameObject3.transform.parent = parent;
                            gameObject3.transform.localPosition = new Vector3((float)sceneData.BoxUIPos[0], (float)sceneData.BoxUIPos[1], 600f);
                            gameObject3.transform.localScale = Vector3.one;
                            this.SetupLevelChest(gameObject3, num, sceneData.SceneChest, num2);
                        }
                    }
                }
                ListPool<uint>.Release(list);
                if (frame == this._MainFrame)
                {
                    this.main.fx = fx;
                }
                else
                {
                    if (frame == this._LeftFrame)
                    {
                        this.left.fx = fx;
                    }
                    else
                    {
                        if (frame == this._RightFrame)
                        {
                            this.right.fx = fx;
                        }
                    }
                }
            }
        }

        // Token: 0x06010D6A RID: 68970 RVA: 0x0043EC58 File Offset: 0x0043CE58
        protected void OnGoLevelupClick(IXUILabel go)
        {
            uint sceneID = (uint)go.ID;
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            switch (xlevelDocument.CanLevelOpen(sceneID))
            {
                case SceneRefuseReason.PreTask_Notfinish:
                    {
                        XTaskDocument specificDocument = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
                        XTaskInfo mainTask = specificDocument.TaskRecord.MainTask;
                        if (mainTask != null)
                        {
                            uint sceneID2 = XTaskDocument.GetSceneID(ref mainTask.TableData.PassScene);
                            if (mainTask.Status == TaskStatus.TaskStatus_Taked && sceneID2 > 0U)
                            {
                                this._SelectedChapter = XSingleton<XSceneMgr>.singleton.GetSceneChapter((int)sceneID2);
                                this._SelectDifficult = (uint)XSingleton<XSceneMgr>.singleton.GetSceneDifficult((int)sceneID2);
                                this._SelectScene = sceneID2;
                                this._SetupDetailFrame(sceneID2);
                            }
                            else
                            {
                                this.SetVisible(false, true);
                                specificDocument.DoTask(mainTask.ID);
                            }
                        }
                        break;
                    }
                case SceneRefuseReason.PreScene_Notfinish:
                    {
                        SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(sceneID);
                        if (sceneData == null)
                        {
                            XSingleton<XDebug>.singleton.AddGreenLog("scenedata is null", null, null, null, null, null);
                        }
                        else
                        {
                            int unFinishedPreSceneID = xlevelDocument.GetUnFinishedPreSceneID(sceneData);
                            int rank = XSingleton<XStageProgress>.singleton.GetRank(unFinishedPreSceneID);
                            if (rank > 0 || xlevelDocument.CanLevelOpen((uint)unFinishedPreSceneID) == SceneRefuseReason.Admit)
                            {
                                this._SelectScene = (uint)unFinishedPreSceneID;
                                int sceneChapter = XSingleton<XSceneMgr>.singleton.GetSceneChapter(unFinishedPreSceneID);
                                int sceneDifficult = XSingleton<XSceneMgr>.singleton.GetSceneDifficult(unFinishedPreSceneID);
                                if (sceneChapter != this._SelectedChapter || (long)sceneDifficult != (long)((ulong)this._SelectDifficult))
                                {
                                    base.uiBehaviour.m_cbNormal.ForceSetFlag(false);
                                    base.uiBehaviour.m_cbHard.ForceSetFlag(false);
                                    if (sceneDifficult == 0)
                                    {
                                        base.uiBehaviour.m_cbNormal.bChecked = true;
                                        this.OnSwitchDifficult(base.uiBehaviour.m_Normal);
                                    }
                                    else
                                    {
                                        base.uiBehaviour.m_cbHard.bChecked = true;
                                        this.OnSwitchDifficult(base.uiBehaviour.m_Hard);
                                    }
                                    this._SelectDifficult = (uint)sceneDifficult;
                                    this._SelectedChapter = sceneChapter;
                                }
                                this._SetupDetailFrame((uint)unFinishedPreSceneID);
                            }
                            else
                            {
                                int sceneChapter2 = XSingleton<XSceneMgr>.singleton.GetSceneChapter(unFinishedPreSceneID);
                                int sceneDifficult2 = XSingleton<XSceneMgr>.singleton.GetSceneDifficult(unFinishedPreSceneID);
                                if (sceneChapter2 != this._SelectedChapter || (long)sceneDifficult2 != (long)((ulong)this._SelectDifficult))
                                {
                                    IXUICheckBox ixuicheckBox = base.uiBehaviour.m_Normal.gameObject.GetComponent("XUICheckBox") as IXUICheckBox;
                                    IXUICheckBox ixuicheckBox2 = base.uiBehaviour.m_Hard.gameObject.GetComponent("XUICheckBox") as IXUICheckBox;
                                    ixuicheckBox.bChecked = false;
                                    ixuicheckBox2.bChecked = false;
                                    if (sceneDifficult2 == 0)
                                    {
                                        ixuicheckBox.bChecked = true;
                                        this.OnSwitchDifficult(base.uiBehaviour.m_Normal);
                                    }
                                    else
                                    {
                                        ixuicheckBox2.bChecked = true;
                                        this.OnSwitchDifficult(base.uiBehaviour.m_Hard);
                                    }
                                    this._SelectDifficult = (uint)sceneDifficult2;
                                    this._SelectedChapter = sceneChapter2;
                                }
                            }
                        }
                        break;
                    }
            }
        }

        // Token: 0x06010D6B RID: 68971 RVA: 0x0043EFA4 File Offset: 0x0043D1A4
        protected void SetupBossAvatar(int chapter, uint difficult, GameObject frame)
        {
            if (this.bossDummy != null)
            {
                XSingleton<X3DAvatarMgr>.singleton.EnableCommonDummy(this.bossDummy, null, false);
            }
            List<uint> list = ListPool<uint>.Get();
            XSingleton<XSceneMgr>.singleton.GetSceneListByChapter(chapter, list);
            if (list.Count == 0)
            {
                ListPool<uint>.Release(list);
            }
            else
            {
                list.Sort();
                if (list.Count != 0)
                {
                    uint sceneID = list[list.Count - 1];
                    if (this._isShowBossAvatar)
                    {
                        int rank = XSingleton<XStageProgress>.singleton.GetRank((int)sceneID);
                        if (rank >= 0)
                        {
                            ListPool<uint>.Release(list);
                        }
                        else
                        {
                            if (rank < 0 && list.Count > 1)
                            {
                                if (list.Count < 2)
                                {
                                    return;
                                }
                                XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
                                uint sceneID2 = list[list.Count - 2];
                                int rank2 = XSingleton<XStageProgress>.singleton.GetRank((int)sceneID2);
                                if (rank2 > 0 && xlevelDocument.CanLevelOpen(sceneID) == SceneRefuseReason.Admit)
                                {
                                    ListPool<uint>.Release(list);
                                    return;
                                }
                            }
                            ListPool<uint>.Release(list);
                            Transform transform = frame.transform.Find("Levels");
                            Transform child = transform.GetChild(transform.childCount - 1);
                            if (child.gameObject.name.StartsWith("chest"))
                            {
                                child = transform.GetChild(transform.childCount - 2);
                            }
                            IUIDummy iuidummy = child.Find("Snapshot").GetComponent("UIDummy") as IUIDummy;
                            Vector3 localPosition = iuidummy.transform.localPosition;
                            localPosition.z = -100f;
                            iuidummy.transform.localPosition = localPosition;
                            XChapter.RowData chapter2 = XSingleton<XSceneMgr>.singleton.GetChapter(chapter);
                            if (chapter2 != null)
                            {
                                XEntityStatistics.RowData byID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID((uint)chapter2.BossID);
                                if (byID != null)
                                {
                                    this.bossDummy = XSingleton<X3DAvatarMgr>.singleton.CreateCommonEntityDummy(this.m_dummPool, byID.PresentID, iuidummy, this.bossDummy, 1f);
                                }
                            }
                            else
                            {
                                XSingleton<XDebug>.singleton.AddErrorLog(string.Format("error chapterId = {0}", chapter), null, null, null, null, null);
                            }
                        }
                    }
                }
            }
        }

        // Token: 0x06010D6C RID: 68972 RVA: 0x0043F21C File Offset: 0x0043D41C
        public void SetupChapterImage()
        {
            base.uiBehaviour.m_ScenePool.ReturnAll(true);
            base.uiBehaviour.m_SceneFramePool.ReturnAll(false);
            this.SceneDic.Clear();
            this._MainFrame = null;
            this._LeftFrame = null;
            this._RightFrame = null;
            this._bLevelIsMoving = false;
            this._MainFrame = this.GetLevelFrame();
            base.uiBehaviour.m_LevelTween.gameObject.transform.Find("LevelFramePanel").localPosition = Vector3.zero;
            this._MainFrame.transform.localPosition = Vector3.zero;
            this._MainFrame.name = string.Format("chapter{0}", this._SelectedChapter);
            this._ChapterRank = 0;
            this._ChapterTotalRank = 0;
            this._FirstNoRankScene = 0U;
            this.SetupChapterBaseImage(this._SelectedChapter, this._SelectDifficult, this._MainFrame);
            this.SetupChapterExInfo();
            if (this._bAutoSelect)
            {
                if (this._SelectScene > 0U)
                {
                    this._SetupDetailFrame(this._SelectScene);
                }
                this._bAutoSelect = false;
            }
        }

        // Token: 0x06010D6D RID: 68973 RVA: 0x0043F348 File Offset: 0x0043D548
        protected void SetupLeftChapterImage()
        {
            int previousChapter = XSingleton<XSceneMgr>.singleton.GetPreviousChapter(this._SelectedChapter);
            if (previousChapter != 0)
            {
                if (this._LeftFrame == null)
                {
                    this._LeftFrame = this.GetLevelFrame();
                }
                if (this._LeftFrame == null)
                {
                    XSingleton<XDebug>.singleton.AddGreenLog("SetupLeftChapterImage,_LeftFrame is null!", null, null, null, null, null);
                }
                else
                {
                    if (this._MainFrame == null)
                    {
                        XSingleton<XDebug>.singleton.AddGreenLog("SetupLeftChapterImage,_MainFrame is null!", null, null, null, null, null);
                    }
                    else
                    {
                        this._LeftFrame.transform.localPosition = this._MainFrame.transform.localPosition + new Vector3(-1136f, 0f);
                        this._LeftFrame.name = "chapter" + previousChapter;
                        this.SetupChapterBaseImage(previousChapter, this._SelectDifficult, this._LeftFrame);
                    }
                }
            }
        }

        // Token: 0x06010D6E RID: 68974 RVA: 0x0043F44C File Offset: 0x0043D64C
        protected void SetupRightChapterImage()
        {
            int nextChapter = XSingleton<XSceneMgr>.singleton.GetNextChapter(this._SelectedChapter);
            if (nextChapter != this._SelectedChapter)
            {
                int playerLastChapter = XSingleton<XStageProgress>.singleton.GetPlayerLastChapter(this._SelectDifficult);
                if (nextChapter <= playerLastChapter)
                {
                    if (this._RightFrame == null)
                    {
                        this._RightFrame = this.GetLevelFrame();
                    }
                    if (this._RightFrame == null)
                    {
                        XSingleton<XDebug>.singleton.AddGreenLog("SetupRightChapterImage,_RightFrame is null!", null, null, null, null, null);
                    }
                    else
                    {
                        if (this._MainFrame == null)
                        {
                            XSingleton<XDebug>.singleton.AddGreenLog("SetupRightChapterImage,_MainFrame is null!", null, null, null, null, null);
                        }
                        else
                        {
                            this._RightFrame.transform.localPosition = this._MainFrame.transform.localPosition + new Vector3(1136f, 0f, 0f);
                            this._RightFrame.name = "chapter" + nextChapter;
                            this.SetupChapterBaseImage(nextChapter, this._SelectDifficult, this._RightFrame);
                        }
                    }
                }
            }
        }

        // Token: 0x06010D6F RID: 68975 RVA: 0x0043F57C File Offset: 0x0043D77C
        protected void SetupLevelChest(GameObject level, uint sceneID, int dropID, int rank)
        {
            IXUISprite ixuisprite = level.transform.Find("LevelPic").GetComponent("XUISprite") as IXUISprite;
            IXUISprite ixuisprite2 = level.transform.Find("Star1").GetComponent("XUISprite") as IXUISprite;
            IXUISprite ixuisprite3 = level.transform.Find("Star2").GetComponent("XUISprite") as IXUISprite;
            IXUISprite ixuisprite4 = level.transform.Find("Star3").GetComponent("XUISprite") as IXUISprite;
            GameObject gameObject = level.transform.Find("TaskHint").gameObject;
            IXUISprite ixuisprite5 = level.transform.Find("Box").GetComponent("XUISprite") as IXUISprite;
            IXUISprite ixuisprite6 = level.transform.Find("BoxFx").GetComponent("XUISprite") as IXUISprite;
            IXUILabel ixuilabel = level.transform.Find("Hint").GetComponent("XUILabel") as IXUILabel;
            IXUISprite ixuisprite7 = level.transform.Find("SprBtn").GetComponent("XUISprite") as IXUISprite;
            ixuisprite7.SetGrey(rank > 0);
            ixuisprite7.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSceneChestClicked));
            ixuisprite7.ID = (ulong)sceneID;
            ixuisprite6.gameObject.SetActive(false);
            if (this._SelectDifficult == 0U)
            {
                ixuisprite.SetSprite("gk_0");
            }
            else
            {
                ixuisprite.SetSprite("gk_1");
            }
            ixuisprite2.gameObject.SetActive(false);
            ixuisprite3.gameObject.SetActive(false);
            ixuisprite4.gameObject.SetActive(false);
            gameObject.gameObject.SetActive(false);
            ixuilabel.gameObject.SetActive(false);
            ixuisprite5.gameObject.SetActive(true);
            ixuisprite5.ID = (ulong)sceneID;
        }

        // Token: 0x06010D70 RID: 68976 RVA: 0x0043F768 File Offset: 0x0043D968
        public void SetupChangeChapterUI()
        {
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            int previousChapter = XSingleton<XSceneMgr>.singleton.GetPreviousChapter(this._SelectedChapter);
            if (previousChapter > 0)
            {
                base.uiBehaviour.m_Left.gameObject.SetActive(true);
                GameObject gameObject = base.uiBehaviour.m_Left.gameObject.transform.Find("RedPoint").gameObject;
                if (xlevelDocument.HasChapterRedpoint(previousChapter))
                {
                    gameObject.SetActive(true);
                }
                else
                {
                    gameObject.SetActive(false);
                }
            }
            else
            {
                base.uiBehaviour.m_Left.gameObject.SetActive(false);
            }
            int nextChapter = XSingleton<XSceneMgr>.singleton.GetNextChapter(this._SelectedChapter);
            int playerLastChapter = XSingleton<XStageProgress>.singleton.GetPlayerLastChapter(this._SelectDifficult);
            if (nextChapter != this._SelectedChapter && playerLastChapter >= nextChapter)
            {
                base.uiBehaviour.m_Right.gameObject.SetActive(true);
                GameObject gameObject2 = base.uiBehaviour.m_Right.gameObject.transform.Find("RedPoint").gameObject;
                if (xlevelDocument.HasChapterRedpoint(nextChapter))
                {
                    gameObject2.SetActive(true);
                }
                else
                {
                    gameObject2.SetActive(false);
                }
            }
            else
            {
                base.uiBehaviour.m_Right.gameObject.SetActive(false);
            }
            if (this._SelectDifficult == 0U)
            {
                base.uiBehaviour.m_NormalRedpoint.SetActive(false);
                base.uiBehaviour.m_HardRedpoint.SetActive(xlevelDocument.HasDifficultAllChapterRedpoint(1));
            }
            else
            {
                base.uiBehaviour.m_HardRedpoint.SetActive(false);
                base.uiBehaviour.m_NormalRedpoint.SetActive(xlevelDocument.HasDifficultAllChapterRedpoint(0));
            }
        }

        // Token: 0x06010D71 RID: 68977 RVA: 0x0043F945 File Offset: 0x0043DB45
        public override void StackRefresh()
        {
            base.StackRefresh();
            base.Alloc3DAvatarPool("DungeonSelect");
            this.SetupPlayerAvatar();
            this.SetupBossAvatar(this._SelectedChapter, this._SelectDifficult, this._MainFrame);
            this.RefreshHardLeftCount();
        }

        // Token: 0x06010D72 RID: 68978 RVA: 0x0043F984 File Offset: 0x0043DB84
        public void SetupPlayerAvatar()
        {
            if (this.main.fx != null)
            {
                this.main.fx.SetActive(true);
                IXUITweenTool ixuitweenTool = this.main.fx.transform.Find("me").GetComponent("XUIPlayTween") as IXUITweenTool;
                if (ixuitweenTool != null)
                {
                    ixuitweenTool.StopTween();
                    ixuitweenTool.ResetTween(true);
                    ixuitweenTool.PlayTween(true, -1f);
                }
            }
        }

        // Token: 0x06010D73 RID: 68979 RVA: 0x0043FA0C File Offset: 0x0043DC0C
        public void UpdateSceneEnterTime()
        {
            if (base.uiBehaviour.m_SceneDetail.activeInHierarchy)
            {
                this._SetupDetailFrame(this._SelectScene);
                this.RefreshHardLeftCount();
            }
        }

        // Token: 0x06010D74 RID: 68980 RVA: 0x0043FA44 File Offset: 0x0043DC44
        public void UpdateSceneBox()
        {
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            Transform transform = this._MainFrame.transform.Find("Levels");
            int childCount = transform.childCount;
            for (int i = 0; i < childCount; i++)
            {
                Transform child = transform.GetChild(i);
                if (child.gameObject.name.StartsWith("chest"))
                {
                    IXUISprite ixuisprite = child.Find("LevelPic").GetComponent("XUISprite") as IXUISprite;
                    IXUISprite ixuisprite2 = child.Find("Box").GetComponent("XUISprite") as IXUISprite;
                    IXUISprite ixuisprite3 = child.Find("BoxFx").GetComponent("XUISprite") as IXUISprite;
                    IXUITweenTool ixuitweenTool = child.Find("Box").GetComponent("XUIPlayTween") as IXUITweenTool;
                    uint num = (uint)ixuisprite2.ID;
                    SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(num);
                    if (sceneData != null && sceneData.SceneChest > 0)
                    {
                        ixuisprite2.gameObject.SetActive(true);
                        if (xlevelDocument.SceneBox.Contains(num))
                        {
                            ixuisprite2.spriteName = "xz01_1";
                            ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSceneChestClicked));
                            ixuisprite3.gameObject.SetActive(false);
                            ixuisprite.SetEnabled(true);
                            ixuitweenTool.ResetTween(true);
                        }
                        else
                        {
                            ixuisprite2.spriteName = "xz01_0";
                            ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSceneChestClicked));
                            int rank = XSingleton<XStageProgress>.singleton.GetRank((int)num);
                            if (rank <= 0)
                            {
                                ixuisprite3.gameObject.SetActive(false);
                                ixuisprite.SetEnabled(false);
                                ixuitweenTool.ResetTween(true);
                            }
                            else
                            {
                                ixuisprite3.gameObject.SetActive(true);
                                ixuisprite.SetEnabled(true);
                                ixuitweenTool.PlayTween(true, -1f);
                            }
                        }
                    }
                }
            }
            this.SetupChangeChapterUI();
        }

        // Token: 0x06010D75 RID: 68981 RVA: 0x0043FC74 File Offset: 0x0043DE74
        protected void OnSceneChestClicked(IXUISprite sp)
        {
            base.uiBehaviour.m_BoxFrame.SetActive(true);
            base.uiBehaviour.m_BoxFetch.ID = sp.ID;
            SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData((uint)sp.ID);
            if (sceneData == null)
            {
                XSingleton<XDebug>.singleton.AddGreenLog("OnSceneChestClicked sceneData is null", null, null, null, null, null);
            }
            else
            {
                XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
                base.uiBehaviour.m_BoxRedPoint.SetActive(false);
                base.uiBehaviour.m_BoxChest.SetActive(true);
                base.uiBehaviour.m_BoxStar.gameObject.SetActive(false);
                int rank = XSingleton<XStageProgress>.singleton.GetRank((int)sp.ID);
                if (rank <= 0)
                {
                    base.uiBehaviour.m_BoxFetch.SetEnable(false, false);
                    base.uiBehaviour.m_BoxFetch.SetCaption(XStringDefineProxy.GetString("SRS_FETCH"));
                }
                else
                {
                    if (xlevelDocument.SceneBox.Contains((uint)sceneData.id))
                    {
                        base.uiBehaviour.m_BoxFetch.SetEnable(false, false);
                        base.uiBehaviour.m_BoxFetch.SetCaption(XStringDefineProxy.GetString("SRS_FETCHED"));
                    }
                    else
                    {
                        base.uiBehaviour.m_BoxFetch.SetEnable(true, false);
                        base.uiBehaviour.m_BoxRedPoint.SetActive(true);
                        base.uiBehaviour.m_BoxFetch.SetCaption(XStringDefineProxy.GetString("SRS_FETCH"));
                    }
                }
                this.SetupBoxReward(sceneData.SceneChest);
                base.uiBehaviour.m_BoxFetch.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSceneChestBoxFetch));
            }
        }

        // Token: 0x06010D76 RID: 68982 RVA: 0x0043FE40 File Offset: 0x0043E040
        protected void ReturnLevelFrameToPool(GameObject frame)
        {
            if (frame == null)
            {
                XSingleton<XDebug>.singleton.AddErrorLog("ReturnLevelFrameToPool frame is null", null, null, null, null, null);
            }
            else
            {
                List<GameObject> list = new List<GameObject>();
                Transform transform = frame.transform.Find("Levels");
                if (transform != null)
                {
                    for (int i = 0; i < transform.childCount; i++)
                    {
                        list.Add(transform.GetChild(i).gameObject);
                    }
                    for (int j = 0; j < list.Count; j++)
                    {
                        base.uiBehaviour.m_ScenePool.ReturnInstance(list[j], true);
                    }
                    base.uiBehaviour.m_SceneFramePool.ReturnInstance(frame, false);
                }
            }
        }

        // Token: 0x06010D77 RID: 68983 RVA: 0x0043FF14 File Offset: 0x0043E114
        protected bool OnLevelBgDrag(Vector2 delta)
        {
            if (delta.x > 0f)
            {
                this.OnMoveLeft(null);
            }
            else
            {
                this.OnMoveRight(null);
            }
            return true;
        }

        // Token: 0x06010D78 RID: 68984 RVA: 0x0043FF50 File Offset: 0x0043E150
        protected bool OnMoveLeft(IXUIButton go)
        {
            bool result;
            if (this._bLevelIsMoving)
            {
                result = true;
            }
            else
            {
                int previousChapter = XSingleton<XSceneMgr>.singleton.GetPreviousChapter(this._SelectedChapter);
                if (previousChapter > 0)
                {
                    this._SelectedChapter = previousChapter;
                    Vector3 localPosition = base.uiBehaviour.m_LevelTween.gameObject.transform.Find("LevelFramePanel").localPosition;
                    Vector3 to = localPosition + new Vector3(1136f, 0f);
                    if (base.uiBehaviour.m_LevelTween != null)
                    {
                        this._bLevelIsMoving = true;
                    }
                    base.uiBehaviour.m_LevelTween.ResetTweenByGroup(true, 0);
                    base.uiBehaviour.m_LevelTween.SetPositionTweenPos(1, localPosition, to);
                    base.uiBehaviour.m_LevelTween.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnMoveLeftOver));
                    base.uiBehaviour.m_LevelTween.PlayTween(true, -1f);
                    XSingleton<XDebug>.singleton.AddLog("MoveLeft-->> _bLevelIsMoving =" + this._bLevelIsMoving.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
                }
                result = true;
            }
            return result;
        }

        // Token: 0x06010D79 RID: 68985 RVA: 0x0044007C File Offset: 0x0043E27C
        protected void OnMoveLeftOver(IXUITweenTool tween)
        {
            this._bLevelIsMoving = false;
            this.ReturnLevelFrameToPool(this._MainFrame);
            if (this._RightFrame != null)
            {
                this.ReturnLevelFrameToPool(this._RightFrame);
            }
            this._RightFrame = null;
            this._MainFrame = this._LeftFrame;
            this._LeftFrame = null;
            this.main.Copy(ref this.left);
            this.left.Clear();
            this.right.Clear();
            this.SetupChapterExInfo();
            XSingleton<XDebug>.singleton.AddLog("MoveLeftOver..... _bLevelIsMoving =" + this._bLevelIsMoving.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
        }

        // Token: 0x06010D7A RID: 68986 RVA: 0x00440130 File Offset: 0x0043E330
        protected bool OnMoveRight(IXUIButton go)
        {
            bool result;
            if (this._bLevelIsMoving)
            {
                result = true;
            }
            else
            {
                int nextChapter = XSingleton<XSceneMgr>.singleton.GetNextChapter(this._SelectedChapter);
                int playerLastChapter = XSingleton<XStageProgress>.singleton.GetPlayerLastChapter(this._SelectDifficult);
                if (nextChapter != this._SelectedChapter && playerLastChapter >= nextChapter)
                {
                    this._SelectedChapter = nextChapter;
                    Vector3 localPosition = base.uiBehaviour.m_LevelTween.gameObject.transform.Find("LevelFramePanel").localPosition;
                    Vector3 to = localPosition + new Vector3(-1136f, 0f);
                    if (base.uiBehaviour.m_LevelTween != null)
                    {
                        this._bLevelIsMoving = true;
                    }
                    base.uiBehaviour.m_LevelTween.ResetTweenByGroup(true, 0);
                    base.uiBehaviour.m_LevelTween.SetPositionTweenPos(1, localPosition, to);
                    base.uiBehaviour.m_LevelTween.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnMoveRightOver));
                    base.uiBehaviour.m_LevelTween.PlayTween(true, -1f);
                    XSingleton<XDebug>.singleton.AddLog("MoveRight-->> _bLevelIsMoving =" + this._bLevelIsMoving.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
                }
                result = true;
            }
            return result;
        }

        // Token: 0x06010D7B RID: 68987 RVA: 0x0044027C File Offset: 0x0043E47C
        protected void OnMoveRightOver(IXUITweenTool tween)
        {
            this._bLevelIsMoving = false;
            this.ReturnLevelFrameToPool(this._MainFrame);
            if (this._LeftFrame != null)
            {
                this.ReturnLevelFrameToPool(this._LeftFrame);
            }
            this._LeftFrame = null;
            this._MainFrame = this._RightFrame;
            this._RightFrame = null;
            this.main.Copy(ref this.right);
            this.left.Clear();
            this.right.Clear();
            this.SetupChapterExInfo();
            XSingleton<XDebug>.singleton.AddLog("MoveRightOver..... _bLevelIsMoving =" + this._bLevelIsMoving.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
        }

        // Token: 0x06010D7C RID: 68988 RVA: 0x00440330 File Offset: 0x0043E530
        protected void SetupChapterExInfo()
        {
            if (this._MainFrame == null)
            {
                this._bLevelIsMoving = false;
                XSingleton<XDebug>.singleton.AddGreenLog("SetupChapterExInfo,_MainFrame is null!", null, null, null, null, null);
            }
            else
            {
                Transform parent = this._MainFrame.transform.Find("me/Effect");
                this.PlayEffect(ref this.m_fx, this.EffectPath, parent);
                parent = this._MainFrame.transform.Find("me/Effect/Effect");
                this.PlayEffect(ref this.m_fx1, this.EffectPath1, parent);
                this.SetupLeftChapterImage();
                this.SetupRightChapterImage();
                this.SetupPlayerAvatar();
                //zcg this.SetupBossAvatar(this._SelectedChapter, this._SelectDifficult, this._MainFrame);
                this.SetupChapterBoxProgress();
                this.SetupChangeChapterUI();
                this.UpdateSceneEnterTime();
                this.UpdateSceneBox();
            }
        }

        // Token: 0x06010D7D RID: 68989 RVA: 0x00440410 File Offset: 0x0043E610
        private void PlayEffect(ref XFx fx, string path, Transform parent)
        {
            if (fx == null)
            {
                fx = XSingleton<XFxMgr>.singleton.CreateFx(path, null, true);
            }
            else
            {
                fx.SetActive(true);
            }
            fx.Play(parent, Vector3.zero, Vector3.one, 1f, true, false);
        }

        // Token: 0x06010D7E RID: 68990 RVA: 0x0044045C File Offset: 0x0043E65C
        public void SetupChapterBoxProgress()
        {
            List<uint> list = ListPool<uint>.Get();
            XSingleton<XSceneMgr>.singleton.GetSceneListByChapter(this._SelectedChapter, list);
            if (list.Count == 0)
            {
                ListPool<uint>.Release(list);
            }
            else
            {
                list.Sort();
                this._ChapterTotalRank = (this._ChapterRank = 0);
                this._FirstNoRankScene = 0U;
                for (int i = 0; i < list.Count; i++)
                {
                    uint num = list[i];
                    SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(num);
                    int num2 = 0;
                    if (sceneData != null)
                    {
                        num2 = XSingleton<XStageProgress>.singleton.GetRank(sceneData.id);
                    }
                    if (num2 == -1)
                    {
                        num2 = 0;
                    }
                    if (sceneData != null)
                    {
                        this._ChapterTotalRank += 3;
                        this._ChapterRank += num2;
                    }
                    if (num2 <= 0)
                    {
                        if (this._FirstNoRankScene == 0U)
                        {
                            this._FirstNoRankScene = num;
                        }
                    }
                }
                ListPool<uint>.Release(list);
                base.uiBehaviour.m_Rank.SetText(this._ChapterRank + "/" + this._ChapterTotalRank);
                base.uiBehaviour.m_RankProgress.value = (float)this._ChapterRank / (float)this._ChapterTotalRank;
                XChapter.RowData chapter = XSingleton<XSceneMgr>.singleton.GetChapter(this._SelectedChapter);
                if (chapter == null)
                {
                    XSingleton<XDebug>.singleton.AddErrorLog("SetupChapterBoxProgress chData is null", null, null, null, null, null);
                }
                else
                {
                    int num3 = 390;
                    base.uiBehaviour.m_RankBox.FakeReturnAll();
                    for (int j = 0; j < chapter.Drop.Count; j++)
                    {
                        int num4 = chapter.Drop[j, 0];
                        GameObject gameObject = base.uiBehaviour.m_RankBox.FetchGameObject(false);
                        gameObject.transform.localPosition = base.uiBehaviour.m_RankBox.TplPos + new Vector3((float)(num3 * num4 / this._ChapterTotalRank), 0f);
                        IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite;
                        IXUISprite ixuisprite2 = gameObject.transform.Find("Box").GetComponent("XUISprite") as IXUISprite;
                        IXUILabel ixuilabel = gameObject.transform.Find("Star").GetComponent("XUILabel") as IXUILabel;
                        IXUITweenTool ixuitweenTool = gameObject.transform.Find("Box").GetComponent("XUIPlayTween") as IXUITweenTool;
                        IXUISprite ixuisprite3 = gameObject.transform.Find("Fx").GetComponent("XUISprite") as IXUISprite;
                        ixuilabel.SetText(num4.ToString());
                        ixuisprite2.ID = (ulong)((long)j);
                        ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnChapterBoxClicked));
                        ixuisprite.ID = (ulong)((long)j);
                        ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnChapterBoxClicked));
                        if (this._ChapterRank >= num4)
                        {
                            if (XSingleton<XStageProgress>.singleton.HasChapterBoxFetched(this._SelectedChapter, j))
                            {
                                ixuisprite2.spriteName = "xz02_1";
                                ixuisprite3.SetAlpha(0f);
                                ixuitweenTool.ResetTween(true);
                            }
                            else
                            {
                                ixuisprite2.spriteName = "xz02_0";
                                ixuisprite3.SetAlpha(1f);
                                ixuitweenTool.PlayTween(true, -1f);
                            }
                        }
                        else
                        {
                            ixuisprite2.spriteName = "xz02_0";
                            ixuisprite3.SetAlpha(0f);
                            ixuitweenTool.ResetTween(true);
                        }
                    }
                    base.uiBehaviour.m_RankBox.ActualReturnAll(false);
                }
            }
        }

        // Token: 0x06010D7F RID: 68991 RVA: 0x00440840 File Offset: 0x0043EA40
        protected void OnChapterBoxClicked(IXUISprite sp)
        {
            if (!this._bLevelIsMoving)
            {
                base.uiBehaviour.m_BoxFrame.SetActive(true);
                int index = (int)sp.ID;
                base.uiBehaviour.m_BoxFetch.ID = sp.ID;
                base.uiBehaviour.m_BoxRedPoint.SetActive(false);
                XChapter.RowData chapter = XSingleton<XSceneMgr>.singleton.GetChapter(this._SelectedChapter);
                if (chapter == null)
                {
                    XSingleton<XDebug>.singleton.AddErrorLog("OnChapterBoxClicked chdata is null", null, null, null, null, null);
                }
                else
                {
                    base.uiBehaviour.m_BoxChest.SetActive(false);
                    base.uiBehaviour.m_BoxStar.gameObject.SetActive(true);
                    base.uiBehaviour.m_BoxStar.SetText(chapter.Drop[index, 0] + "/" + this._ChapterTotalRank);
                    if (this._ChapterRank < chapter.Drop[index, 0])
                    {
                        base.uiBehaviour.m_BoxFetch.SetEnable(false, false);
                        base.uiBehaviour.m_BoxFetch.SetCaption(XStringDefineProxy.GetString("SRS_FETCH"));
                    }
                    else
                    {
                        if (XSingleton<XStageProgress>.singleton.HasChapterBoxFetched(this._SelectedChapter, index))
                        {
                            base.uiBehaviour.m_BoxFetch.SetEnable(false, false);
                            base.uiBehaviour.m_BoxFetch.SetCaption(XStringDefineProxy.GetString("SRS_FETCHED"));
                        }
                        else
                        {
                            base.uiBehaviour.m_BoxFetch.SetEnable(true, false);
                            base.uiBehaviour.m_BoxRedPoint.SetActive(true);
                            base.uiBehaviour.m_BoxFetch.SetCaption(XStringDefineProxy.GetString("SRS_FETCH"));
                        }
                    }
                    this.SetupBoxReward(chapter.Drop[index, 1]);
                    base.uiBehaviour.m_BoxFetch.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnChapterBoxFetch));
                }
            }
        }

        // Token: 0x06010D80 RID: 68992 RVA: 0x00440A44 File Offset: 0x0043EC44
        protected void SetupBoxReward(int dropID)
        {
            base.uiBehaviour.m_BoxRewardPool.ReturnAll(false);
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            List<XDropData> dropData = xlevelDocument.GetDropData(dropID);
            if (dropData != null)
            {
                int num = (dropData.Count + 1) / 2 - 1;
                int num2 = (int)((float)((dropData.Count + 1) % 2) * base.uiBehaviour.m_BoxRewardPool.TplPos.x);
                Vector3 vector = new Vector3((float)(num2 - num * base.uiBehaviour.m_BoxRewardPool.TplWidth), base.uiBehaviour.m_BoxRewardPool.TplPos.y);
                for (int i = 0; i < dropData.Count; i++)
                {
                    XDropData xdropData = dropData[i];
                    GameObject gameObject = base.uiBehaviour.m_BoxRewardPool.FetchGameObject(false);
                    gameObject.transform.localPosition = vector + new Vector3((float)(i * base.uiBehaviour.m_BoxRewardPool.TplWidth), 0f);
                    XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, xdropData.itemID, xdropData.count, false);
                    IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
                    ixuisprite.ID = (ulong)((long)xdropData.itemID);
                    ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
                }
            }
        }

        // Token: 0x06010D81 RID: 68993 RVA: 0x00440BD3 File Offset: 0x0043EDD3
        protected void OnChapterBoxBgClick(IXUISprite sp)
        {
            base.uiBehaviour.m_BoxFrame.SetActive(false);
        }

        // Token: 0x06010D82 RID: 68994 RVA: 0x00440BE8 File Offset: 0x0043EDE8
        protected bool OnChapterBoxFetch(IXUIButton go)
        {
            RpcC2G_FetchChapterChest rpcC2G_FetchChapterChest = new RpcC2G_FetchChapterChest();
            rpcC2G_FetchChapterChest.oArg.chapterID = this._SelectedChapter;
            rpcC2G_FetchChapterChest.oArg.chestID = (int)go.ID;
            XSingleton<XClientNetwork>.singleton.Send(rpcC2G_FetchChapterChest);
            return true;
        }

        // Token: 0x06010D83 RID: 68995 RVA: 0x00440C34 File Offset: 0x0043EE34
        protected bool OnSceneChestBoxFetch(IXUIButton go)
        {
            RpcC2G_OpenSceneChest rpcC2G_OpenSceneChest = new RpcC2G_OpenSceneChest();
            rpcC2G_OpenSceneChest.oArg.sceneID = (uint)go.ID;
            XSingleton<XClientNetwork>.singleton.Send(rpcC2G_OpenSceneChest);
            return true;
        }

        // Token: 0x06010D84 RID: 68996 RVA: 0x00440C6C File Offset: 0x0043EE6C
        public void OnFetchSceneChestSucc()
        {
            base.uiBehaviour.m_BoxFrame.SetActive(false);
            this.UpdateSceneBox();
        }

        // Token: 0x06010D85 RID: 68997 RVA: 0x00440C88 File Offset: 0x0043EE88
        public void OnFetchChapterBoxSucc()
        {
            base.uiBehaviour.m_BoxFrame.SetActive(false);
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            xlevelDocument.RefreshRedPoint();
            this.SetupChapterBoxProgress();
        }

        // Token: 0x06010D86 RID: 68998 RVA: 0x00440CD0 File Offset: 0x0043EED0
        protected void _SetupDetailFrame(uint sceneID)
        {
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            XMainInterfaceDocument xmainInterfaceDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XMainInterfaceDocument.uuID) as XMainInterfaceDocument;
            base.uiBehaviour.m_SceneDetail.gameObject.SetActive(true);
            this._SceneRemainTime = 9999U;
            SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(sceneID);
            int rank = XSingleton<XStageProgress>.singleton.GetRank((int)sceneID);
            uint sceneDifficult = (uint)XSingleton<XSceneMgr>.singleton.GetSceneDifficult((int)sceneID);
            if (sceneData == null)
            {
                XSingleton<XDebug>.singleton.AddErrorLog("_SetupDetailFrame sceneData is null", null, null, null, null, null);
            }
            else
            {
                base.uiBehaviour.m_SceneRecommendHint.SetVisible(0 < sceneData.RecommendHint.Length);
                base.uiBehaviour.m_SceneRecommendHint.SetText(string.Format("       {0}", sceneData.RecommendHint));
                if (sceneDifficult == 0U)
                {
                    base.uiBehaviour.m_SceneNormal.SetActive(true);
                    base.uiBehaviour.m_SceneHard.SetActive(false);
                    base.uiBehaviour.m_HardLeftCountGo1.SetActive(false);
                    base.uiBehaviour.m_SceneSoloBattle.gameObject.SetActive(false);
                    base.uiBehaviour.m_SceneTeamBattle.gameObject.SetActive(false);
                    base.uiBehaviour.m_SceneGoBattle.gameObject.SetActive(true);
                }
                else
                {
                    base.uiBehaviour.m_SceneNormal.SetActive(false);
                    base.uiBehaviour.m_SceneHard.SetActive(true);
                    base.uiBehaviour.m_HardLeftCountGo1.SetActive(true);
                    base.uiBehaviour.m_SceneGoBattle.gameObject.SetActive(false);
                    if (rank <= 0)
                    {
                        base.uiBehaviour.m_SceneSoloBattle.gameObject.SetActive(false);
                        base.uiBehaviour.m_SceneTeamBattle.gameObject.SetActive(true);
                        base.uiBehaviour.m_SceneTeamBattle.gameObject.transform.localPosition = base.uiBehaviour.m_SceneGoBattle.gameObject.transform.localPosition;
                    }
                    else
                    {
                        base.uiBehaviour.m_SceneSoloBattle.gameObject.SetActive(false);
                        base.uiBehaviour.m_SceneTeamBattle.gameObject.SetActive(true);
                        base.uiBehaviour.m_SceneTeamBattle.gameObject.transform.localPosition = base.uiBehaviour.m_SceneTeamBattlePos;
                    }
                }
                base.uiBehaviour.m_SceneName.SetText(sceneData.Comment);
                int num = -1;
                for (int i = 0; i < XLevelRewardDocument.Table.Table.Length; i++)
                {
                    if (XLevelRewardDocument.Table.Table[i].scendid == sceneID)
                    {
                        num = i;
                        break;
                    }
                }
                if (num >= 0)
                {
                    base.uiBehaviour.m_SceneStarCond[1].SetText(LevelRewardGerenalHandler.GetReqText(XLevelRewardDocument.Table.Table[num], 1));
                    base.uiBehaviour.m_SceneStarCond[2].SetText(LevelRewardGerenalHandler.GetReqText(XLevelRewardDocument.Table.Table[num], 2));
                }
                for (int j = 0; j < 3; j++)
                {
                    if (XSingleton<XStageProgress>.singleton.GetRankDetail((int)sceneID, j))
                    {
                        base.uiBehaviour.m_SceneStar[j].SetColor(Color.white);
                    }
                    else
                    {
                        base.uiBehaviour.m_SceneStar[j].SetColor(Color.grey);
                    }
                }
                base.uiBehaviour.m_SceneDropPool.ReturnAll(false);
                Vector3 tplPos = base.uiBehaviour.m_SceneDropPool.TplPos;
                int tplWidth = base.uiBehaviour.m_SceneDropPool.TplWidth;
                int tplHeight = base.uiBehaviour.m_SceneDropPool.TplHeight;
                if (XSingleton<XAttributeMgr>.singleton.XPlayerData != null)
                {
                    int num2 = (int)(xlevelDocument.GetExpAddition((int)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level) * (double)sceneData.Exp);
                    base.uiBehaviour.m_DropExpLab.SetText(num2.ToString());
                }
                if (sceneData.Money == 0)
                {
                    base.uiBehaviour.m_DropExpLab1.gameObject.transform.parent.gameObject.SetActive(false);
                }
                else
                {
                    base.uiBehaviour.m_DropExpLab1.gameObject.transform.parent.gameObject.SetActive(true);
                    base.uiBehaviour.m_DropExpLab1.SetText(sceneData.Money.ToString());
                }
                int num3 = (sceneData.ViewableDropList != null) ? sceneData.ViewableDropList.Length : 0;
                int num4 = 6;
                int num5 = Mathf.Max(num3, num4);
                for (int k = 0; k < num5; k++)
                {
                    int num6 = k;
                    GameObject gameObject = base.uiBehaviour.m_SceneDropPool.FetchGameObject(false);
                    gameObject.name = k.ToString();
                    gameObject.transform.localPosition = tplPos + new Vector3((float)(tplWidth * num6), 0f, 0f);
                    gameObject.transform.localScale = Vector3.one;
                    GameObject gameObject2 = gameObject.transform.Find("Item").gameObject;
                    if (k >= num3 && k < num4)
                    {
                        gameObject2.SetActive(false);
                    }
                    else
                    {
                        gameObject2.SetActive(true);
                        XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject2, sceneData.ViewableDropList[k], 0, false);
                        IXUISprite ixuisprite = gameObject2.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
                        ixuisprite.ID = (ulong)sceneData.ViewableDropList[k];
                        ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickItemIcon));
                    }
                }
                int playerPPT = xmainInterfaceDocument.GetPlayerPPT();
                string difficulty = XLevelDocument.GetDifficulty(playerPPT, sceneData.RecommendPower);
                base.uiBehaviour.m_SceneHint.SetText(difficulty);
                base.uiBehaviour.m_SceneRecommendPPT.SetText(string.Format("{0}{1}[-]", difficulty.Substring(0, 8), sceneData.RecommendPower));
                base.uiBehaviour.m_SceneMyPPT.SetText(playerPPT.ToString());
                if (this._SelectDifficult == 1U)
                {
                    string arg;
                    if (playerPPT >= sceneData.SweepNeedPPT)
                    {
                        arg = "[9ce500]";
                    }
                    else
                    {
                        arg = "[e30000]";
                    }
                    if (XSingleton<XAttributeMgr>.singleton.XPlayerData != null)
                    {
                        if ((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level < (ulong)((long)XSingleton<XGlobalConfig>.singleton.GetInt("SweepPPTLevelLimit")))
                        {
                            base.uiBehaviour.m_SweepPPT.gameObject.SetActive(false);
                            base.uiBehaviour.m_SweepPPTName.SetActive(false);
                        }
                        else
                        {
                            base.uiBehaviour.m_SweepPPT.gameObject.SetActive(true);
                            base.uiBehaviour.m_SweepPPT.SetText(string.Format("{0}{1}[-]", arg, sceneData.SweepNeedPPT));
                            base.uiBehaviour.m_SweepPPTName.SetActive(true);
                            base.uiBehaviour.m_SweepTicketLab.SetText(XBagDocument.BagDoc.GetItemCount(XSingleton<XGlobalConfig>.singleton.GetInt("SweepTicketId")).ToString());
                        }
                    }
                    base.uiBehaviour.m_SceneQuick10Lab.SetText(string.Format(XStringDefineProxy.GetString("SWEEP_TITLE"), 5));
                }
                else
                {
                    base.uiBehaviour.m_SweepPPT.SetText("");
                    base.uiBehaviour.m_SweepPPTName.SetActive(false);
                    base.uiBehaviour.m_SceneQuick10Lab.SetText(string.Format(XStringDefineProxy.GetString("SWEEP_TITLE"), 10));
                }
                uint num7 = sceneData.DayLimitGroupID;
                if (num7 == 0U)
                {
                    num7 = sceneID;
                }
                uint num8 = 0U;
                if (xlevelDocument.SceneDayEnter.TryGetValue(num7, out num8))
                {
                    this._SceneRemainTime = (uint)sceneData.DayLimit - num8;
                    if ((long)sceneData.DayLimit - (long)((ulong)num8) == 0L)
                    {
                        base.uiBehaviour.m_SceneQuick1.gameObject.SetActive(false);
                        base.uiBehaviour.m_SceneQuick10.gameObject.SetActive(false);
                    }
                    else
                    {
                        base.uiBehaviour.m_SceneQuick1.gameObject.SetActive(true);
                        base.uiBehaviour.m_SceneQuick10.gameObject.SetActive(true);
                    }
                }
                else
                {
                    base.uiBehaviour.m_SceneQuick1.gameObject.SetActive(true);
                    base.uiBehaviour.m_SceneQuick10.gameObject.SetActive(true);
                }
                if (rank < 3)
                {
                    base.uiBehaviour.m_SceneQuick1.gameObject.SetActive(false);
                    base.uiBehaviour.m_SceneQuick10.gameObject.SetActive(false);
                    base.uiBehaviour.m_SweepTicketGo.SetActive(false);
                    base.uiBehaviour.m_SceneFirstSSS.SetActive(true);
                    string text = "";
                    for (int l = 0; l < sceneData.FirstSSS.Count; l++)
                    {
                        text += XLabelSymbolHelper.FormatCostWithIcon((int)sceneData.FirstSSS[l, 1], (ItemEnum)sceneData.FirstSSS[l, 0]);
                    }
                    base.uiBehaviour.m_SceneFirstSSSReward.InputText = text;
                }
                else
                {
                    if (this._SelectDifficult == 0U)
                    {
                        base.uiBehaviour.m_SceneQuick1.gameObject.SetActive(true);
                        base.uiBehaviour.m_SceneQuick10.gameObject.SetActive(true);
                        base.uiBehaviour.m_SweepTicketGo.SetActive(false);
                    }
                    else
                    {
                        if (XSingleton<XAttributeMgr>.singleton.XPlayerData != null)
                        {
                            if ((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level < (ulong)((long)XSingleton<XGlobalConfig>.singleton.GetInt("SweepPPTLevelLimit")))
                            {
                                base.uiBehaviour.m_SceneQuick1.gameObject.SetActive(false);
                                base.uiBehaviour.m_SceneQuick10.gameObject.SetActive(false);
                                base.uiBehaviour.m_SweepTicketGo.SetActive(false);
                            }
                            else
                            {
                                base.uiBehaviour.m_SceneQuick1.gameObject.SetActive(true);
                                base.uiBehaviour.m_SceneQuick10.gameObject.SetActive(true);
                                base.uiBehaviour.m_SweepTicketGo.SetActive(true);
                            }
                        }
                    }
                    base.uiBehaviour.m_SceneFirstSSS.SetActive(false);
                }
                base.uiBehaviour.m_Cost.InputText = XLabelSymbolHelper.FormatCostWithIcon(sceneData.FatigueCost[0, 1], ItemEnum.FATIGUE);
                base.uiBehaviour.m_SceneSoloBattleCost.InputText = XLabelSymbolHelper.FormatCostWithIcon(sceneData.FatigueCost[0, 1], ItemEnum.FATIGUE);
                base.uiBehaviour.m_SceneTeamBattleCost.InputText = XLabelSymbolHelper.FormatCostWithIcon(sceneData.FatigueCost[0, 1], ItemEnum.FATIGUE);
            }
        }

        // Token: 0x06010D87 RID: 68999 RVA: 0x0044185C File Offset: 0x0043FA5C
        private void OnClickItemIcon(IXUISprite spr)
        {
            XItem mainItem = XBagDocument.MakeXItem((int)spr.ID, false);
            XSingleton<UiUtility>.singleton.ShowTooltipDialogWithSearchingCompare(mainItem, spr, false, 0U);
        }

        // Token: 0x06010D88 RID: 69000 RVA: 0x00441888 File Offset: 0x0043FA88
        private void OnSceneSelected(IXUISprite sp)
        {
            XLevelDocument xlevelDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XLevelDocument.uuID) as XLevelDocument;
            this._SelectScene = (uint)sp.ID;
            if (this._FirstNoRankScene > 0U)
            {
                if (this._SelectScene == this._FirstNoRankScene)
                {
                    SceneTable.RowData sceneData = XSingleton<XSceneMgr>.singleton.GetSceneData(this._SelectScene);
                    if (sceneData == null)
                    {
                        XSingleton<XDebug>.singleton.AddErrorLog("OnSceneSelected sceneData is null", null, null, null, null, null);
                        return;
                    }
                    SceneRefuseReason sceneRefuseReason = xlevelDocument.CanLevelOpen(this._SelectScene);
                    if (sceneRefuseReason == SceneRefuseReason.PreTask_Notfinish)
                    {
                        base.uiBehaviour.m_MainHintText.SetText(string.Format(XStringDefineProxy.GetString("LEVEl_REQUIRE_TASK"), sceneData.RequiredLevel));
                        base.uiBehaviour.m_MainHint.PlayTween(true, -1f);
                        return;
                    }
                    if (sceneRefuseReason == SceneRefuseReason.PreScene_Notfinish)
                    {
                        int unFinishedPreSceneID = xlevelDocument.GetUnFinishedPreSceneID(sceneData);
                        SceneTable.RowData sceneData2 = XSingleton<XSceneMgr>.singleton.GetSceneData((uint)unFinishedPreSceneID);
                        if (sceneData2 != null)
                        {
                            base.uiBehaviour.m_MainHintText.SetText(string.Format(XStringDefineProxy.GetString("LEVEL_REQUIRE_PRELEVEL"), sceneData2.Comment));
                        }
                        base.uiBehaviour.m_MainHint.PlayTween(true, -1f);
                        return;
                    }
                    if (sceneRefuseReason == SceneRefuseReason.Level_NotEnough)
                    {
                        base.uiBehaviour.m_MainHintText.SetText(string.Format(XStringDefineProxy.GetString("LEVEL_REQUIRE_LEVEL"), sceneData.RequiredLevel));
                        base.uiBehaviour.m_MainHint.PlayTween(true, -1f);
                        return;
                    }
                    if (sceneRefuseReason == SceneRefuseReason.ReachLimitTimes)
                    {
                        base.uiBehaviour.m_MainHintText.SetText(XStringDefineProxy.GetString("LEVEL_REACH_LIMIT_TIMES"));
                        base.uiBehaviour.m_MainHint.PlayTween(false, -1f);
                        return;
                    }
                }
                if (this._SelectScene > this._FirstNoRankScene)
                {
                    base.uiBehaviour.m_MainHintText.SetText(string.Format(XStringDefineProxy.GetString("LEVEL_REQUIRE_DEFAULT"), new object[0]));
                    base.uiBehaviour.m_MainHint.PlayTween(true, -1f);
                    return;
                }
            }
            this._SetupDetailFrame(this._SelectScene);
        }

        // Token: 0x06010D89 RID: 69001 RVA: 0x00441AE4 File Offset: 0x0043FCE4
        public void OnPlayerLevelUp()
        {
            if (base.IsVisible())
            {
                this.SetupChapterImage();
            }
        }

        // Token: 0x06010D8A RID: 69002 RVA: 0x00441B04 File Offset: 0x0043FD04
        public void OnGotSweepRes()
        {
            if (base.IsVisible())
            {
                this.SetupChapterImage();
            }
        }

        // Token: 0x06010D8B RID: 69003 RVA: 0x00441B24 File Offset: 0x0043FD24
        public bool OnDetailClose(IXUIButton go)
        {
            base.uiBehaviour.m_SceneDetail.SetActive(false);
            return true;
        }

        // Token: 0x06010D8C RID: 69004 RVA: 0x00441B4C File Offset: 0x0043FD4C
        public void RefreshHardLeftCount()
        {
            //zcg 
//             XExpeditionDocument specificDocument = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
//             int dayCount = specificDocument.GetDayCount(TeamLevelType.TeamLevelAbyss, null);
//             int dayMaxCount = specificDocument.GetDayMaxCount(TeamLevelType.TeamLevelAbyss, null);
//             string text = string.Format("{0}/{1}", dayCount, dayMaxCount);
//             base.uiBehaviour.m_HardLeftCount1.SetText(text);
//             if (this._welfareDoc.IsOwnMemberPrivilege(MemberPrivilege.KingdomPrivilege_Adventurer))
//             {
//                 int num = 0;
//                 PayMemberTable.RowData memberPrivilegeConfig = this._welfareDoc.GetMemberPrivilegeConfig(MemberPrivilege.KingdomPrivilege_Adventurer);
//                 if (memberPrivilegeConfig != null)
//                 {
//                     num = memberPrivilegeConfig.AbyssCount;
//                 }
//                 int num2 = 0;
//                 if (this._welfareDoc.PayMemberPrivilege != null)
//                 {
//                     num2 = this._welfareDoc.PayMemberPrivilege.usedAbyssCount;
//                 }
//                 if (num2 >= num)
//                 {
//                     base.uiBehaviour.m_HardLeftCount0.SetText(string.Format("{0}/{1}", dayCount, dayMaxCount));
//                     base.uiBehaviour.m_HardLeftCount1.SetText(string.Format("{0}/{1}", dayCount, dayMaxCount));
//                 }
//                 else
//                 {
//                     base.uiBehaviour.m_HardLeftCount0.SetText(string.Format("[ffb400][c]{0}[/c][-]/{1}", dayCount, dayMaxCount));
//                     base.uiBehaviour.m_HardLeftCount1.SetText(string.Format("[ffb400][c]{0}[/c][-]/{1}", dayCount, dayMaxCount));
//                 }
//             }
//             else
//             {
//                 base.uiBehaviour.m_HardLeftCount0.SetText(string.Format("{0}/{1}", dayCount, dayMaxCount));
//                 base.uiBehaviour.m_HardLeftCount1.SetText(string.Format("{0}/{1}", dayCount, dayMaxCount));
//             }

            //zcg
             base.uiBehaviour.m_HardLeftCount0.SetText(string.Format("{0}/{1}", 0, 0));
             base.uiBehaviour.m_HardLeftCount1.SetText(string.Format("{0}/{1}", 0, 0));
        }

        // Token: 0x06010D8D RID: 69005 RVA: 0x00441D08 File Offset: 0x0043FF08
        private void _OnAddHardCountClicked(IXUISprite iSp)
        {
            //zcg DlgBase<XBuyCountView, XBuyCountBehaviour>.singleton.ActiveShow(TeamLevelType.TeamLevelAbyss);
        }

        // Token: 0x06010D8E RID: 69006 RVA: 0x00441D18 File Offset: 0x0043FF18
        private bool OnShopBtnClick(IXUIButton btn)
        {
            SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("AbyssTeamShopLevel", true);
            List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("AbyssTeamShopType");
            int num = 0;
            if (XSingleton<XAttributeMgr>.singleton.XPlayerData != null)
            {
                num = (int)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level;
            }
            for (int i = 0; i < (int)sequenceList.Count; i++)
            {
                if (num >= sequenceList[i, 0] && num <= sequenceList[i, 1])
                {
                    XSysDefine xsysDefine = (XSysDefine)(XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_Mall_MystShop) + intList[i]);
                    bool result;
                    if (XSingleton<XGameSysMgr>.singleton.IsSystemOpened(xsysDefine))
                    {
                        //zcg DlgBase<MallSystemDlg, MallSystemBehaviour>.singleton.ShowShopSystem(xsysDefine, 0UL);
                        result = true;
                    }
                    else
                    {
                        int sysOpenLevel = XSingleton<XGameSysMgr>.singleton.GetSysOpenLevel(XFastEnumIntEqualityComparer<XSysDefine>.ToInt(xsysDefine));
                        XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("SHOP_OPEN_LEVEL"), sysOpenLevel), "fece00");
                        result = false;
                    }
                    return result;
                }
            }
            XSingleton<XDebug>.singleton.AddErrorLog("Can't find player level state from golbalconfig by AbyssTeamShop. level = ", num.ToString(), null, null, null, null);
            return true;
        }

        // Token: 0x04007B8C RID: 31628
        private bool _isShowBossAvatar = true;

        // Token: 0x04007B8D RID: 31629
        private int _HardModeNeedLevel = 0;

        // Token: 0x04007B8E RID: 31630
        private uint _SelectDifficult = 0U;

        // Token: 0x04007B8F RID: 31631
        private int _SelectedChapter = 0;

        // Token: 0x04007B90 RID: 31632
        private uint _SelectScene = 0U;

        // Token: 0x04007B91 RID: 31633
        private bool _bAutoSelect = false;

        // Token: 0x04007B92 RID: 31634
        private bool _bAutoSelectChapterId = true;

        // Token: 0x04007B93 RID: 31635
        private GameObject _MainFrame;

        // Token: 0x04007B94 RID: 31636
        private GameObject _LeftFrame;

        // Token: 0x04007B95 RID: 31637
        private GameObject _RightFrame;

        // Token: 0x04007B96 RID: 31638
        private bool m_bLevelIsMoving = false;

        // Token: 0x04007B97 RID: 31639
        private int _ChapterRank;

        // Token: 0x04007B98 RID: 31640
        private int _ChapterTotalRank;

        // Token: 0x04007B99 RID: 31641
        private const float LEVEL_FRAME_OFFSET = 1136f;

        // Token: 0x04007B9A RID: 31642
        private uint _FirstNoRankScene = 0U;

        // Token: 0x04007B9B RID: 31643
        private Dictionary<uint, GameObject> SceneDic = new Dictionary<uint, GameObject>();

        // Token: 0x04007B9C RID: 31644
        private uint _SceneRemainTime = 9999U;

        // Token: 0x04007B9D RID: 31645
        public bool IsTaskMode = false;

        // Token: 0x04007B9E RID: 31646
        private float m_fSweepBtnCoolTime = 0.5f;

        // Token: 0x04007B9F RID: 31647
        private float m_fGoBattleCoolTime = 5f;

        // Token: 0x04007BA0 RID: 31648
        private float m_fLastClickBtnTime = 0f;

        // Token: 0x04007BA1 RID: 31649
        private DungeonSelect.FrameCache main;

        // Token: 0x04007BA2 RID: 31650
        private DungeonSelect.FrameCache left;

        // Token: 0x04007BA3 RID: 31651
        private DungeonSelect.FrameCache right;

        // Token: 0x04007BA4 RID: 31652
        private XDummy bossDummy = null;

        // Token: 0x04007BA5 RID: 31653
        //zcg private XWelfareDocument _welfareDoc;

        // Token: 0x04007BA6 RID: 31654
        private GameObject m_goLevelUpGo;

        // Token: 0x04007BA7 RID: 31655
        private XFx m_fx;

        // Token: 0x04007BA8 RID: 31656
        private XFx m_fx1;

        // Token: 0x04007BA9 RID: 31657
        private string m_effectPath = string.Empty;

        // Token: 0x04007BAA RID: 31658
        private string m_effectPath1 = string.Empty;

        // Token: 0x02001A22 RID: 6690
        private struct FrameCache
        {
            // Token: 0x06011158 RID: 69976 RVA: 0x00458887 File Offset: 0x00456A87
            public void Clear()
            {
                this.snapShot = null;
                this.fx = null;
            }

            // Token: 0x06011159 RID: 69977 RVA: 0x00458898 File Offset: 0x00456A98
            public void Copy(ref DungeonSelect.FrameCache fc)
            {
                this.snapShot = fc.snapShot;
                if (this.fx != null)
                {
                    this.fx.SetActive(false);
                }
                this.fx = fc.fx;
            }

            // Token: 0x04008278 RID: 33400
            public IUIDummy snapShot;

            // Token: 0x04008279 RID: 33401
            public GameObject fx;
        }
    }
}
